<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 形参默认值，当不传入参数时，默认使用形参默认值，传参使用传入的值
        function person(name = 'rose', age = 18) {
            this.name = name;
            this.age = age;
        }

        let ymy = new person('yumingyang', 30);
        console.log(ymy);
        let dw = new person();
        console.log(dw);

    </script>
</body>

</html>